#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
#include <QProgressBar>
#include <QPushButton>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    // 存在就获取，不存在就创建
    QStatusBar* statusBar = this->statusBar();
    this->setStatusBar(statusBar);

    // 显示临时信息
    // statusBar->showMessage("这是一个状态信息", 3000);

    // 给状态栏添加子控件
    QLabel* lab = new QLabel("这是一个 QLabel");
    statusBar->addWidget(lab);

    QProgressBar* progreeBar = new QProgressBar();
    progreeBar->setRange(0, 100);
    progreeBar->setValue(50);
    statusBar->addWidget(progreeBar);

    QPushButton* button = new QPushButton("按钮");
    statusBar->addPermanentWidget(button);
}

MainWindow::~MainWindow()
{
    delete ui;
}

